/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package BUS;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author ldtung_it
 */
public class CheckData {
    /**
     * check object is number or not
     * @param a
     * @return
     */
    public static boolean isNum(Object a){
        String s = "" +  a;
        try{
            Integer.parseInt(s);
            return true;
        }
        catch(Exception ex){
            return false;
        }

    }
    /**
     * check object is datetime or not
     * @param dt
     * @return
     */
    public static boolean isDatetime(Object dt){
        //dt = (Date)dt;
        String format = "MM/dd/yyyy";
        String s = dt.toString();
        DateFormat myDateFormat = new SimpleDateFormat(format);
        try{
            dt = (Date)dt;
            return true;
        }
        catch(Exception ex){
            return false;
        }

    }
}
